package org.hot100_1;

import org.algorithm.List.ListNode;

public class leetcode23 {
    public ListNode reverseList(ListNode head) {

        if (head==null){
            return head;
        }

        ListNode curr =head;
        ListNode pre=null;
        ListNode next =null;
        while (curr!=null){
            next = curr.next;
            curr.next=pre;
            pre=curr;
            curr=next;
        }

        return pre;
    }

}
